]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/keyboard: Always released held keyboard after activating source
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 11 Oct 2024 12:30:44 +0000 (14:30 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 15 Oct 2024 15:06:36 +0000 (15:06 +0000)
As the keyboard is released asynchronously after setting the ibus
engine, there's a possibility that the `this._reloading` property
changed in the meantime.

To ensure that `holdKeyboard()` and `releaseKeyboard()` are correctly
paired, record the condition in a local variable so that it maintains
its value in the callback.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3476>

js/ui/status/keyboard.js

index 3be8f2cbabbb262486b639c3cdaff1ec63125905..c0153ef8dbb8f3a36f1fec1e9d3c42bcb3a3eb8b 100644 (file)
@@ -503,7 +503,8 @@ export class InputSourceManager extends Signals.EventEmitter {
         // E.g. Focusing on a password entry in a popup in Xorg Firefox
         // will emit 'set-content-type' signal.
         // https://gitlab.gnome.org/GNOME/gnome-shell/issues/391
-        if (!this._reloading)
+        const holdKeyboard = !this._reloading;
+        if (holdKeyboard)
             KeyboardManager.holdKeyboard();
         this._keyboardManager.apply(is.xkbId);
 
@@ -520,7 +521,7 @@ export class InputSourceManager extends Signals.EventEmitter {
             engine = 'xkb:us::eng';
 
         this._ibusManager.setEngine(engine).then(() => {
-            if (!this._reloading)
+            if (holdKeyboard)
                 KeyboardManager.releaseKeyboard();
         });